export default class RuleModel {
  /**
   * 定义索引类型为string
   */
  [index: string]: any
  /**
   * 错误提示
   */
  public message: string = ''
  /**
   * 是否必填
   */
  public required: boolean = false
  /**
   * 触发时机
   */
  public trigger: 'blur' | 'change' = 'blur'
  /**
   * 自定义校验
   * @param rule
   * @param value
   * @param callback
   */
  public validator?: Function

  constructor(arg: RuleModel) {
    for (let key of Object.keys(arg)) {
      this[key] = arg[key]
    }
  }
}
